<template>
    <div>
        <ul class="mui-table-view">
            <li class="mui-table-view-cell mui-media" v-for="item in newsList" :key="item._id">
                <router-link :to="'/home/newsList/newsDetail/'+item._id">
                    <img class="mui-media-object mui-pull-left" :src="item.img_url">
                    <div class="mui-media-body">
                        {{item.title}}
                        <p class='mui-ellipsis'>{{item.describe}}</p>
                    </div>
                    <div class="timeWatch">
                        <span class="time">发表时间: 2018-09-23</span>
                        <span class="watch">阅读量: {{item.click}}</span>
                    </div>
                </router-link>
            </li>
		</ul>
    </div>
</template>

<script>
import { Toast } from 'mint-ui';
export default {
    data() {
        return {
            newsList:null
        }
    },
    created() {
        this.axios.get('/api/newsList').then(body=>{
            if (body.data.status === 1) {
                this.newsList = body.data.message;
            }else{
                Toast("加载新闻列表失败")
            }
        })
    }
}
</script>

<style lang="less" scoped>
.mui-table-view{
    .mui-table-view-cell{
        margin-bottom: 0.75em;
        padding-top: 0.5em; 
        padding-bottom: 0.5em; 
        .timeWatch{
            .time{
                color: blue;
                font-size: 0.75em;
            }
            .watch{
                color: blue;
                font-size: 0.75em;
                float: right;
                margin-right: 1em;
            }
        }
    }
}
</style>
